<?php
$relation_status = DataHelper::getRelationshipWithLoggedInUser($this->profile['account_id']);

if(empty($this->type)) {
	$activity_title = "Activities";
} else {
	$activity_title  = ucfirst($this->type);
}

?>
<section>
	<h2>Profile</h2>
	<?php echo Common::renderFlashMessage() ?>
	<!-- profile -->
	<section>
			<p class="membership">
				<h3><?php echo $this->user['username']; ?>&nbsp;&nbsp;
				<small>
				<?php 
				if ($relation_status == 1):?>
				[ <a href="/user/deletefriend/<?php echo $this->user['username']; ?>">Delete friend</a> ]
				<?php elseif($relation_status == -1) : ?>
				[ <a href="/user/addfriend/<?php echo $this->user['username']; ?>">Add friend</a> ]
				<?php 
				endif; 
				?>
				</small>
				</h3>
			</p>
			<p class="status"><em><?php echo substr( strip_tags($this->shareMessage['share_text']), 0, 500); ?></em></p>
			<p class="membership">Member since <?php echo DataHelper::setDateFormat($this->user['created_on']); ?></p>
	</section>
	<section id="profileDetails">
		<table border="0">
			<?php if ($this->profile->user_name) : ?>
			<tr>
			<th>Name:</th>
			<td><?php echo $this->profile->user_name; ?></td>
			</tr>
			<?php endif ?>
			
			<?php if ($this->profile->user_gender) : ?>
			<tr>
			<th>Gender:</th>
			<td><?php echo $this->profile->user_gender; ?></td>
			</tr>
			<?php endif ?>
			
			<?php if ($this->profile->user_email) : ?>
			<tr>
			<th>Email:</th>
			<td><?php echo $this->profile->user_email; ?></td>
			</tr>
			<?php endif ?>
			
			<?php if ($this->profile->user_address) : ?>
			<tr>
			<th>Address:</th>
			<td><?php echo $this->profile->user_address; ?></td>
			</tr>
			<?php endif ?>
			
			<?php if ($this->profile->user_city) : ?>
			<tr>
			<th>City:</th>
			<td><?php echo $this->profile->user_city; ?></td>
			</tr>
			<?php endif ?>
			
			<?php if ($this->profile->user_state) : ?>
			<tr>
			<th>State:</th>
			<td><?php echo $this->profile->user_state; ?></td>
			</tr>
			<?php endif ?>
			
			<?php if ($this->profile->user_postal) : ?>
			<tr>
			<th>Postal:</th>
			<td><?php echo $this->profile->user_postal; ?></td>
			</tr>
			<?php endif ?>
			
			<?php if ($this->profile->user_phone) : ?>
			<tr>
			<th>Phone:</th>
			<td><?php echo $this->profile->user_phone; ?></td>
			</tr>
			<?php endif ?>
		</table>
	</section>
	
	<!-- plugins area -->
	<section id="plugins">
		<section>
			<h2>Recent <?php echo $activity_title ?></h2>
		
		<?php 
			if ($this->activities):
			foreach($this->activities as $activity): 
		?>
		<article class="activity">
			<q><span class="quote"> <?php echo substr( strip_tags($activity['share_text']), 0, 500); ?></span></q>
			<p><?php echo $activity['share_type']; ?> | <?php echo $activity['share_datetime']; ?></p>
		</article>
		<?php
			endforeach;
			else:
		?>
		<p>No recent Activity</p>
		<?php
			endif;
		?>
		</section>
	</section>
	
</section>